<%@ page import="com.fu.bean.Student" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: fudada
  Date: 2021/1/25
  Time: 16:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<% pageContext.setAttribute("num", 10);%>
基本数据类型：${num} <br>

<% Student student = new Student("张三", 23);
    pageContext.setAttribute("stu",student);
%>

自定义对象：${stu} <br>
学生姓名：${stu.name} <br>
学生年龄：${stu.age} <br>

<%
    String[] arr = {"hello","world"};
    pageContext.setAttribute("arr", arr);
%>

数组 ${arr[0]} <br>
数组 ${arr[1]} <br>

<%
    ArrayList<String> list = new ArrayList<>();
    list.add("aaa");
    list.add("bbb");

    pageContext.setAttribute("list", list);
%>

List集合：${list} <br>
List集合：${list[0]} <br>

<% HashMap<String, Student> hashMap = new HashMap<>();
    hashMap.put("hm01", new Student("李四", 23));
    hashMap.put("hm02", new Student("张三", 23));
    pageContext.setAttribute("map",hashMap);
%>

Map: ${map} <br>
Map: ${map.hm01} <br>
Map: ${map.hm01.name} <br>

</body>
</html>
